package com.jms;

import javax.jms.TextMessage;

import org.json.JSONObject;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jms.core.JmsTemplate;

public class Jms_consumer {

	@SuppressWarnings("resource")
	public static void main(String[] args) throws Exception {
		ApplicationContext context = new ClassPathXmlApplicationContext(
				"applicationContext.xml");
		JmsTemplate template = (JmsTemplate) context.getBean("jmsTemplate");
		TextMessage msg = (TextMessage) template.receive();
		JSONObject json = new JSONObject(msg.getText());
		System.out.println(json.toString());
	}

}
